#include<iostream>
#include<vector>
using namespace std;


class Solution {
public:
    int jump(vector<int>& nums) {
        vector<long long> tmpVt;
        int len = nums.size();
        tmpVt.resize(nums.size() + 1, INT_MAX);
        tmpVt[0] = 0;
        for (int i = 0; i < len; i++) {
            for (int j = 0; i + j < len && j <= nums[i]; j++) {
                tmpVt[i + j] = min(tmpVt[i] + 1, tmpVt[i + j]);
            }
        }
        return tmpVt[len - 1];
    }
};